<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>相对定位练习1</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        div{
            width: 605px;
            height: 40px;
            margin: 100px auto;
        }
        div ul li{
            list-style: none;
            float: left;
            width: 120px;
            height: 40px;
            text-align: center;
            line-height: 40px;
            border-right: 1px solid #fff;
            background: rgb(53, 102, 102);
        }
        div ul li a{
            text-decoration: none;
            color: #fff;
            display: block;
        }
        div ul li a:hover{
            border-top: 5px solid red;
            position: relative;
            bottom: 5px;
        }
    </style>
</head>
<body>
    <div>
        <ul>
            <li><a href="#">首页</a></li>
            <li><a href="#">首页</a></li>
            <li><a href="#">首页</a></li>
            <li><a href="#">首页</a></li>
            <li><a href="#">首页</a></li>
        </ul>
    </div>
</body>
</html>